package com.feicheng.house.controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.house.entity.Record;
import com.feicheng.house.entity.User;
import com.feicheng.house.exception.SystemException;
import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.service.IRecordService;
import com.feicheng.house.service.impl.CardServiceImpl;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-11-06
 */
@RestController
@RequestMapping("/house/record")
public class RecordController {
	@Autowired
	private IRecordService iRecordService;
	
	/**
	 * 查询押金记录
	 * @param depositNumber
	 * @return 查询到的押金记录
	 */
	@GetMapping("/info")
	public ResultInfo getRecordResultInfo(String depositNumber) {
		return iRecordService.getRecordInfo(depositNumber);
	}
	
	/**
	 * 新增押金记录
	 * @param record 押金记录对象
	 * @return Boolean值
	 */
	@PostMapping("/info")
	public ResultInfo addRecordInfo(Record record) {
		return iRecordService.addRecordInfo(record);
	}
	
	/**
	 * 修改押金记录
	 * @param record 押金记录对象
	 * @return Boolean值
	 */
	@PutMapping("/info")
	public ResultInfo editRecordInfo(Record record) {
		return iRecordService.editRecordInfo(record);
	}
	
	/**
	 * 分页查询押金记录
	 * @param currentPage
	 * @param pageSize
	 * @param searchKey	
	 * @return 查询到的押金记录和分页
	 */
	@GetMapping("/page")
	public ResultInfo pagesInfo(
	@RequestParam(required = false,defaultValue = "8")Integer pageSize , @RequestParam(required = false,defaultValue = "1")Integer currentPage , String searchKey) {
	return iRecordService.pagesInfo(pageSize, currentPage, searchKey);
	}
}

